home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / Collision / collision.jar / ColldemoSl45$TextEntry.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-06-20  |  1.9 KB  |  55 lines

  1. import javax.microedition.lcdui.Command;
  2. import javax.microedition.lcdui.CommandListener;
  3. import javax.microedition.lcdui.Display;
  4. import javax.microedition.lcdui.Displayable;
  5. import javax.microedition.lcdui.Screen;
  6. import javax.microedition.lcdui.TextBox;
  7.  
  8. class ColldemoSl45$TextEntry extends TextBox implements CommandListener {
  9.    public static final int VALID = 0;
  10.    public static final int INVALID = 1;
  11.    private Display display;
  12.    private Displayable nextDisp;
  13.    private Command okCommand;
  14.    // $FF: renamed from: Id int
  15.    private int field_0;
  16.    private ColldemoSl45$Game game;
  17.    // $FF: synthetic field
  18.    private final ColldemoSl45 this$0;
  19.  
  20.    public ColldemoSl45$TextEntry(ColldemoSl45 var1, Display var2, Displayable var3, ColldemoSl45$Game var4) {
  21.       super("test", "", 8, 0);
  22.       this.this$0 = var1;
  23.       this.okCommand = new Command("OK", 4, 1);
  24.       this.field_0 = 0;
  25.       this.game = var4;
  26.       this.display = var2;
  27.       this.nextDisp = var3;
  28.       ((Displayable)this).addCommand(this.okCommand);
  29.       ((TextBox)this).setConstraints(0);
  30.       ((Screen)this).setTitle("Hi-score");
  31.    }
  32.  
  33.    public void showMe() {
  34.       ((Displayable)this).setCommandListener(this);
  35.       this.display.setCurrent(this);
  36.    }
  37.  
  38.    public void commandAction(Command var1, Displayable var2) {
  39.       String var4 = ((TextBox)this).getString();
  40.       int var3;
  41.       if (this.field_0 != -1) {
  42.          var3 = this.game.validateAction(var1.getCommandType(), this.field_0, var4);
  43.       } else {
  44.          var3 = 0;
  45.       }
  46.  
  47.       if (var3 == 0) {
  48.          this.display.setCurrent(this.nextDisp);
  49.       } else {
  50.          ((TextBox)this).setString("");
  51.       }
  52.  
  53.    }
  54. }
  55.